1. Field of the Invention
Embodiments of the present invention relate generally to rendering graphics images and more specifically to a modular shader architecture and method for computerized image rendering.
2. Description of the Related Art
High-quality graphics rendering applications are commonly used to generate highly refined images, such as photorealistic graphics images, from mathematical models of three-dimensional (3D) graphics scenes. A graphics scene typically comprises scene objects with material properties, light sources with associated properties, camera positions, and other relevant data configured within a scene database of a modeling application. The modeling application conventionally generates a render database from the scene database. The high-quality rendering application traverses the render database to render a highly refined image from the graphics scene represented within the render database.
The high-quality graphics rendering application typically calls a plurality of shaders configured to impart various physically and visually significant effects on objects within the graphics scene. A shaded pixel may comprise contributions, organized as contribution types, from the plurality of shaders. Each type of shader, such as a material shader, may generate shading results from results computed by a plurality of other shaders, such as lighting shaders. For example, a material shader may generate shading results for a pixel based on specular lighting and diffuse lighting for a point on a scene object, whereby each source of lighting is computed from a corresponding lighting shader. A given shader may be a standard shader and provided as part of the rendering application, or the shader may be a custom shader, created by a shader developer. Each shader, whether standard or custom, may generate a contribution type that may be well known or custom.
Because the goal of high-quality rendering applications is to render images to the highest technically feasible standards, custom shaders are commonly employed to beneficially render certain visual effects and enhance overall image quality. These custom shaders may be separately invoked in a process known in the art as a render pass to generate images corresponding to standard contribution types or custom contribution types.
In order to simultaneously accommodate multiple standard and custom shaders and potential interdependencies between each, high-quality rendering applications conventionally perform a set of separate render passes to drive one shader to compute a complete rendering pass. However, each render pass typically requires significant computation independent of specific shader computations. Therefore, superfluous computations are required in order to perform each additional render pass, leading to inefficiency in the high-quality rendering application. Because the computational load related to a high-quality rendering application typically accounts for a majority of an overall computational effort for a given rendered end product, this inefficiency can be very costly to users.
Furthermore, each custom shader is typically required to implement significant rendering infrastructure related to generic rendering in a specific application context, but not related to the custom shading technique provided by the shader. This rendering infrastructure needs to be replicated for each custom shader, leading to workflow inefficiencies for software developers creating custom shaders.
As the foregoing illustrates, what is needed in the art is a technique for improving efficiency in developing and executing high-quality rendering applications.